#include "sampleinfodialog.h"
#include "ui_sampleinfodialog.h"


#include "SampleAnalysis/Model/sampleinfodao.h"

SampleInfoDialog::SampleInfoDialog(QWidget *parent) :
    QDialog(parent),
    IDialog(),
    ui(new Ui::SampleInfoDialog)
{
    ui->setupUi(this);
    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setGeometry(this->getCenter(this->geometry().width(),this->geometry().height()));
    sampleInfoDao = new SampleInfoDao();
}

SampleInfoDialog::~SampleInfoDialog()
{
    delete ui;
    delete sampleInfoDao;
}



void SampleInfoDialog::on_Btn_OK_clicked()
{
    setSampleInfo();
    this->accept();
}


void SampleInfoDialog::on_Btn_cancel_clicked()
{
    this->reject();
}

SampleInfoDao *SampleInfoDialog::getSampleInfo()
{
    return sampleInfoDao;
}

void SampleInfoDialog::setSampleInfo()
{
    sampleInfoDao->age = ui->nu_Edit_age->text();
    sampleInfoDao->ageType = ui->comboBox_age->currentText();
    sampleInfoDao->bedNumber = ui->en_bed_num->text();
    sampleInfoDao->date = ui->dateEdit_birthday->text();
    sampleInfoDao->department = ui->ch_comboBox_depar->currentText();
    sampleInfoDao->id = ui->ch_Sample_Name->text();
    sampleInfoDao->medicalNumber = ui->en_M_Record_Num->text();
    sampleInfoDao->name = ui->ch_Sample_Name->text();
    sampleInfoDao->patientType = ui->comboBox_patient->currentText();
    sampleInfoDao->refGroup = ui->comboBox_refer_group->currentText();
    sampleInfoDao->sampletime = ui->dateTimeEdit_sample->text();
    sampleInfoDao->sender = ui->dateTimeEdit_inspec->text();
    sampleInfoDao->sendtime = ui->dateTimeEdit_inspec->text();
    sampleInfoDao->sex = ui->comboBox_sex->currentText();
    sampleInfoDao->text = "";
}

